package com.cy.ppj.model;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.List;

/**
 * @description: 分页
 * @author: Ocean
 * @create: 2018-06-03 02:36
 **/
@Data
@ApiModel("分页数据")
public class PageBean<T> {

    @ApiModelProperty(value = "是否执行成功")
    public boolean ok;

    @ApiModelProperty(value = "错误码", example = "0")
    private int code;

    @ApiModelProperty(value = "错误码信息")
    private String message;

    @ApiModelProperty(value = "列表")
    private List<T> data;

    @ApiModelProperty(value = "数据总数", example = "0")
    private int total;

    public PageBean(String message) {
        this.ok = false;
        this.message = message;
    }

    public PageBean(List<T> data, int total) {
        this.ok = true;
        this.code = 0;
        this.message = "查询成功";
        this.data = data;
        this.total = total;
    }
}
